package com.kaiyidiannao.activity.menu_right;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
import com.kaiyidiannao.main.R;
import com.kaiyidiannao.view.ActionBarView;

/**
 * Created by mark on 2014/4/17.
 */
public class JoinIn extends TabActivity {
    private TabHost tabHost;
    private TextView user_login;
    private TextView user_registered;
    private ActionBarView actionBarView;
    int i = 1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.join_in);
        actionBarView = (ActionBarView) findViewById(R.id.login_actionBar);
        actionBarView.setTitle("加盟");
        tabHost = this.getTabHost();
        final TabWidget tabWidget = tabHost.getTabWidget();
        LayoutInflater inflater = LayoutInflater.from(this);
        View view = inflater.inflate(R.layout.login_bt, null);
        user_login = (TextView) view.findViewById(R.id.user_login);

//        tabWidget.setLeftStripDrawable(getResources().getDrawable(R.color.title_bar_bg));
//        tabWidget.setRightStripDrawable(getResources().getDrawable(R.color.title_bar_bg));
        tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
                for (int i = 0; i < tabWidget.getChildCount(); i++) {
                    View vvv = tabHost.getTabWidget().getChildAt(i);
                    if (tabHost.getCurrentTab() == i) {
                        Log.d("00000000000","0000000000000000");
                        vvv.setBackgroundResource(R.drawable.selector_bg);
                    }else{
                        Log.d("00000000000","11111111111111111");
                        vvv.setBackgroundResource(R.drawable.selector_bg_01);
                    }
                }
            }
        });

        user_login.setText("商家");
        Intent intent1 = new Intent(this, Seller.class);
        tabHost.addTab(tabHost.newTabSpec("").setContent(intent1).setIndicator(view));

        Intent intent2 = new Intent(this, Proxy.class);
        view = inflater.inflate(R.layout.login_registered,null);
        user_registered = (TextView) view.findViewById(R.id.user_registered);
        user_registered.setText("软件合作代理");
        tabHost.addTab(tabHost.newTabSpec("").setContent(intent2).setIndicator(view));
        tabHost.setCurrentTab(0);
    }


}
